home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 February / CHIPCD_02_2002.iso / Internet / Macromedia ColdFusion Server 5 / coldfusion-50-win-us.exe / data1.cab / Examples / CFDOCS / snippets / structcount.cfm < prev    next >
Encoding:
Text File  |  2001-06-13  |  1.4 KB  |  36 lines

  1. <!--- This view-only example illustrates usage
  2.       of StructCount. --->
  3. <P>This file is similar to addemployee.cfm, which is called
  4. by StructNew, StructClear, and StructDelete. To test this file,
  5. copy the StructCount function to the appropriate place
  6. in addemployee.cfm.
  7. <P>
  8. To run this snippet
  9. under UNIX, you must add employee ID generation logic.
  10. <!--- 
  11. <cfswitch expression="#ThisTag.ExecutionMode#">
  12.    <cfcase value="start">
  13.       <CFIF StructIsEmpty(attributes.EMPINFO)>
  14.         <CFOUTPUT>Error. No employee data was passed.</cfoutput>
  15.           <CFEXIT METHOD="ExitTag">
  16.         <cfelse>
  17.           <CFQUERY NAME="AddEmployee" DATASOURCE="cfsnippets">
  18.             INSERT INTO Employees(FirstName, LastName, Email, Phone, Department)
  19.               VALUES 
  20.                 <CFOUTPUT>
  21.                   (
  22.                     '#StructFind(attributes.EMPINFO, "firstname")#' ,
  23.                     '#StructFind(attributes.EMPINFO, "lastname")#' ,
  24.                     '#StructFind(attributes.EMPINFO, "email")#' ,
  25.                     '#StructFind(attributes.EMPINFO, "phone")#' ,
  26.                     '#StructFind(attributes.EMPINFO, "department")#'
  27.                    )
  28.                 </cfoutput> 
  29.           </cfquery>
  30.         </cfif>
  31.       <CFOUTPUT><HR>Employee Add Complete
  32.          <P>#StructCount(attributes.EMPINFO)# columns added.</cfoutput>
  33.    </cfcase>
  34. </cfswitch> --->
  35.  
  36.